/**
 * @param {number[]} flowerbed
 * @param {number} n
 * @return {boolean}
 */
var canPlaceFlowers = function(flowerbed, n) {
    let keng=[0,...flowerbed,0];
    let plan=0;
    const kengsnum=keng.length;
    for(let i =1;i<kengsnum;i++){
        if(keng[i-1]===0&&keng[i]===0&&keng[i+1]===0){
            keng[i]=1;
            plan+=1;
        }
    }
    return plan >= n;
};

(function f() {
    k=[1,0,0,0,1];
    n=1;
    console.log(canPlaceFlowers(k, n));
})()
